#include "class_factory.h"
#include<iostream>
using namespace std;

Shape::Shape(string id)
{
     this->id = id;
     cout<< "正在构建Shape" << endl;
}

string Shape:: getId()
{
    return this->id;
}

Shape::~Shape()
{
     cout<< "正在析构Shape" << endl;
}

double Shape::  area()
{
    return 0;
}

Rectangle::Rectangle(std::string id, double width,double height): Shape(id)
{
    this->width = width;
    this->height = height;
}

Rectangle:: ~Rectangle() 

{
    this->width = 0;
    this->height = 0;
    cout<< "正在析构Rectangle" << endl;
}
double Rectangle::area()
{
    cout<<"调用父类的方法:"<<Shape::area()<<endl;
    return this->width * this->height;
}
